<%@ Language=VBScript%>
<%
	Session("FormName")="F2"
%>
<!--#include file="..\CheckSession.inc"-->
<!--#include file=..\getFormName.inc-->
<%
	bBack=request("bBack")+1
	If request("bComm")="ok" then
		IPMailServer=Request("TxtIPMailServer")
		ForumAddress=Request("TxtForumAddress")
		bDatabase=Request("TxtDatabase")
		bSua=Request("bSua")
		bSMTPPort=request("TxtSMTPPort")
		bPopIP=Request("TxtPopIP")
		bPopPort=Request("TxtPopPort")
		bPopUser=Request("TxtPopUser")
		bPopPass=Request("TxtPopPass")
		bFaxIP=Request("TxtFaxIP")
		bFaxUser=Request("TxtFaxUser")
		bFaxPass=Request("TxtFaxPass")
		bWebMailAddress=Request("TxtWebMailAddress")
		bWebMailPort=Request("TxtWebMailPort")
		
		bSiteUser=Request("TxtSiteUser")
		bSitePass=Request("TxtSitePass")
		
		SiteIPMailServer=Request("TxtSiteIPMailServer")
		bSiteSMTPPort=request("TxtSiteSMTPPort")
		bSitePopIP=Request("TxtSitePopIP")
		bSitePopPort=Request("TxtSitePopPort")		
				
		bSiteDomain=Request("TxtSiteDomain")
		
		bTenDonVi=Request("TxtTenDonVi")		
		
		Set ClsFun=server.CreateObject("Vinalines.ClsFunction")		
		if trim(IPMailServer)<>"" or trim(ForumAddress)<>"" then			
			if bSua then
				sSQL="Update config Set FaxPassword='"& ClsFun.ModiString(bFaxPass) &"', " & _
						" FaxUsername='"& ClsFun.ModiString(bFaxUser) &"', " & _
						" FaxIPServer='"& ClsFun.ModiString(bFaxIP) &"', " & _
						" Pop3Username='"& ClsFun.ModiString(bPopUser) &"', " & _
						" Pop3Password='"& ClsFun.ModiString(bPopPass) &"', " & _
						" Pop3Port='"& ClsFun.ModiString(bPopPort) &"', " & _
						" Pop3IPMail='"& ClsFun.ModiString(bPopIP) &"', " & _
						" Databasename= '"& ClsFun.ModiString(TRIM(bDatabase)) &"', " & _
						" port='"& ClsFun.ModiString(bSMTPPort) &"', " & _
						" IPMailServer='"& ClsFun.ModiString(IPMailServer) &"', " & _
						" ForumAddress='"& ClsFun.ModiString(ForumAddress) &"', " & _
						" WebMailAddress='"& ClsFun.ModiString(bWebMailAddress) &"', " & _
						" WebMailPort='"& ClsFun.ModiString(bWebMailPort) &"', " & _
						" SiteIPMailServer='"& ClsFun.ModiString(SiteIPMailServer) &"', " & _
						" Siteport='"& ClsFun.ModiString(bSiteSMTPPort) &"', " & _
						" SitePop3IPMail='"& ClsFun.ModiString(bSitePopIP) &"', " & _
						" SitePop3Port='"& ClsFun.ModiString(bSitePopPort) &"', " & _
						" SiteUsername='"& ClsFun.ModiString(bSiteUser) &"', " & _
						" SitePassword='"& ClsFun.ModiString(bSitePass) &"', " & _
						" SiteDomain='"& ClsFun.ModiString(bSiteDomain) &"', " & _
						" TenDonVi='"& ClsFun.ModiString(bTenDonVi) &"'"
						
			else
				sSQL="Insert into config(Pop3IPMail,Pop3Port,Pop3Password,Pop3Username,FaxIPServer,Faxusername,FaxPassword,Databasename,IPMailServer,ForumAddress,port,WebMailAddress,WebMailPort,SiteIPMailServer,Siteport,SitePop3IPMail,SitePop3Port,SiteUsername,SitePassword,SiteDomain,TenDonVi) values('"& ClsFun.ModiString(bPopIP) &"','"& ClsFun.ModiString(bPopPort) &"','"& ClsFun.ModiString(bPopPass) &"','"& ClsFun.ModiString(bPopUser) &"','"& ClsFun.ModiString(bFaxIP) &"','"& ClsFun.ModiString(bFaxUser) &"','"& ClsFun.ModiString(bFaxPass) &"','"& ClsFun.ModiString(trim(bDatabase)) &"','"& ClsFun.ModiString(IPMailServer) &"','"& ClsFun.ModiString(ForumAddress) &"','"& ClsFun.ModiString(bSMTPport) &"','"& ClsFun.ModiString(bWebMailAddress) &"','"& ClsFun.ModiString(bWebMailPort) &"','"& ClsFun.ModiString(SiteIPMailServer) &"','"& ClsFun.ModiString(bSiteSMTPPort) &"','"& ClsFun.ModiString(bSitePopIP) &"','"& ClsFun.ModiString(bSitePopPort) &"','"& ClsFun.ModiString(bSiteUser) &"','"& ClsFun.ModiString(bSitePass) &"','"& ClsFun.ModiString(bSiteDomain) &"','"& ClsFun.ModiString(bTenDonVi) &"')"
			end if		
						
			Application("SiteUserName")=bSiteUser
			Application("SitePassword")=bSitePass
			Application("bTenDonVi")=bTenDonVi
			Application("ForumAddress")=ForumAddress
			Conn.Execute sSQL
		end if
	End if
	sSQL="Select * from Config"
	Set Rec=Server.CreateObject("ADODB.Recordset")
	Rec.CursorType=3
	Rec.CacheSize=5
	Rec.Open sSQL,Conn
	bIPMailServer=""
	if Rec.RecordCount then
		bIPMailServer=Rec("IPMailServer")
		bForumAddress=Rec("ForumAddress")
		bDatabase=Rec("Databasename")
		bSMTPPort=Rec("port")
		bPopIP=Rec("Pop3IPMail")
		bPopPort=rec("Pop3Port")
		bPopUser=rec("Pop3Username")
		bPopPass=rec("Pop3Password")
		bFaxIP=rec("FaxIPServer")
		bFaxUser=rec("FaxUsername")
		bFaxPass=rec("FaxPassword")
		bWebMailAddress=rec("WebMailAddress")
		bWebMailPort=rec("WebMailPort")
		bSiteUser=rec("SiteUsername")
		bSitePass=rec("SitePassword")		
		
		bSiteIPMailServer=Rec("SiteIPMailServer")
		bSiteSMTPPort=Rec("Siteport")
		bSitePopIP=Rec("SitePop3IPMail")
		bSitePopPort=rec("SitePop3Port")
		
		bSiteDomain=Rec("SiteDomain")
		bTenDonVi=Rec("TenDonVi")
	end if
	Rec.Close
	Set Rec=nothing
	set Conn=nothing
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>H&#7879; Qu&#7843;n Tr&#7883; V&#259;n Th&#432;</title>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function CmdCancel_onclick() {
	window.history.go(-<%=bBack%>);
}

//-->
</SCRIPT>
</head>
<LINK href="../styles/styles.css" type=text/css rel=STYLESHEET>
<body bgcolor=#f8f9d9  style="FONT-FAMILY: Arial" topmargin=2 leftmargin=2>
<%
	if (bIPMailServer)="" then
		bSua=false
	else
		bSua=true
	end if
%>
<form name=frm method=post action="config.asp?bBack=<%=bBack%>&bComm=ok&bSua=<%=bSua%>">
<table border="0" width="100%" style="border-style:solid;border-color:#C0C0C0; border-collapse:collapse" cellspacing="0" cellpadding="0">  
  <tr>
    <td width="100%" colspan=4 align=center><font color=blue><B>Thi&#7871;t l&#7853;p c&#7845;u h&#236;nh</B></font></td>
  </tr>
  <tr>
    <td width="20%">SMTP IP Address</td>
    <td width="30%">
	    <input maxlength=50 name=TxtIPMailServer value='<%=trim(bIPMailServer)%>' style="WIDTH:100%" size="20">
    </td>
    <td width="20%" align=center>SMTP Port(25)</td>
    <td width="30%">
	    <input maxlength=50 name=TxtSMTPPort value='<%=trim(bSMTPPort)%>' style="WIDTH: 100%" size="20"></td>
  </tr>
  <tr>
    <td width="20%">POP3 IP Address</td>
    <td width="30%">
	    <input maxlength=50 name=TxtPopIP value='<%=trim(bPOPIP)%>' style="WIDTH: 100%" size="20">
    </td>
    <td width="20%" align=center>POP3 Port(110)</td>
    <td width="30%">
	    <!--<input maxlength=50  name=TxtPopPort value='110' style="WIDTH: 100%" size="20"> -->
	    <input maxlength=50  name=TxtPopPort value='<%=trim(bPopPort)%>' style="WIDTH: 100%" size="20"> 	    
</td>
  </tr>
  <tr>
    <td width="20%">POP3 User Name</td>
    <td width="30%">
	    <input maxlength=50 name=TxtPopuser value='<%=trim(bPOPuser)%>' style="WIDTH: 100%" size="20"></td>
    <td width="20%" align=center>POP3 Password</td>
    <td width="30%">
	    <input maxlength=50 name=TxtPopPass type=password value='<%=trim(bPOPPass)%>' style="WIDTH: 100%" size="20"></td>
  </tr>
  <tr><td colspan=4 width="100%"><hr></td></tr>
  <tr>
    <td width="20%">Fax Server Address</td>
    <td width="80%" colspan=3><input maxlength=50 name=TxtFaxIP value='<%=trim(bFaxIP)%>' style="WIDTH: 100%" size="20"></td>
  </tr>
  <tr>
    <td width="20%">Fax User Name</td>
    <td width="30%">
	    <input maxlength=50 name=TxtFaxUser value='<%=trim(bFaxUser)%>' style="WIDTH: 100%" size="20"></td>
    <td width="20%" align=center>Fax Password</td>
    <td width="30%">
	    <input maxlength=50 name=TxtFaxPass type=password value='<%=trim(bFaxPass)%>' style="WIDTH:100%" size="20"></td>
  </tr>
  <tr><td colspan=4 width="100%"><hr></td></tr>
  <tr>
    <td width="20%">Database name</td>
    <td width="30%">
    <input maxlength=50 name=TxtDatabase value='<%=trim(bDatabase)%>' style="WIDTH: 100%" size="20"></td>
    <td width="20%" align=center>Forum Address</td>
    <td width="30%">
    <input maxlength=50 name=TxtForumAddress value='<%=trim(bForumAddress)%>' style="WIDTH: 100%" size="20"></td>
  </tr>
    <tr>
    <td width="20%">WebMail Address</td>
    <td width="30%">
    <input maxlength=50 name=TxtWebMailAddress value='<%=trim(bWebMailAddress)%>' style="WIDTH: 100%" size="20"></td>
    <td width="20%" align=center>WebMail Port</td>
    <td width="30%">
    <input maxlength=50 name=TxtWebMailPort value='<%=trim(bWebMailPort)%>' style="WIDTH: 100%" size="20"></td>
  </tr>
  <%if Session("IsAdmin") then%>
  <tr><td colspan=4 width="100%"><hr></td></tr>
  <tr>
    <td width="20%">Site SMTP IP Addr</td>
    <td width="30%">
	    <input maxlength=50 name=TxtSiteIPMailServer value='<%=trim(bSiteIPMailServer)%>' style="WIDTH:100%" size="20">
    </td>
    <td width="20%" align=center>Site SMTP Port(25)</td>
    <td width="30%">
	    <input maxlength=50 name=TxtSiteSMTPPort value='<%=trim(bSiteSMTPPort)%>' style="WIDTH: 100%" size="20"></td>
  </tr>
  <tr>
    <td width="20%">Site POP3 IP Addr</td>
    <td width="30%">
	    <input maxlength=50 name=TxtSitePopIP value='<%=trim(bSitePOPIP)%>' style="WIDTH: 100%" size="20">
    </td>
    <td width="20%" align=center>Site POP3 Port(110)</td>
    <td width="30%">
	    <!--<input maxlength=50  name=TxtSitePopPort value='110' style="WIDTH: 100%" size="20"> -->
	    <input maxlength=50  name=TxtSitePopPort value='<%=trim(bSitePopPort)%>' style="WIDTH: 100%" size="20"> 
	</td>
  </tr>    
  <tr>
    <td width="20%">Site User Name</td>
    <td width="30%">
	    <input maxlength=50 name=TxtSiteUser value='<%=trim(bSiteUser)%>' style="WIDTH: 100%" size="20"></td>
    <td width="20%" align=center>Site Password</td>
    <td width="30%">
	    <input maxlength=50 name=TxtSitePass type=password value='<%=trim(bSitePass)%>' style="WIDTH: 100%" size="20"></td>
  </tr>  
  <tr>
    <td width="20%">Site Domain</td>
    <td width="60%" colspan=2><input maxlength=50 name=TxtSiteDomain value='<%=trim(bSiteDomain)%>' style="WIDTH: 100%" size="20"></td>
    <td width="20%">(ex: vnu.edu.vn)</td>
  </tr>
  <tr>
    <td width="20%">Tên đơn vị</td>
    <td width="60%" colspan=3><input maxlength=50 name=TxtTenDonVi value='<%=trim(bTenDonVi)%>' style="WIDTH: 100%" size="20"></td>
  </tr>  
  <%end if%>
  <tr>
    <td width="100%" colspan=4 align=center>
		<input name=CmdOK type=submit value="Ghi nh&#7853;n" style="width:80px">
		<input name=CmdCancel type=button value="Quay l&#7841;i" style="width:80px" LANGUAGE=javascript onclick="return CmdCancel_onclick()">
    </td>
  </tr> 

</table>
</form>
</body>
</html>